package com.wry.myphotowall;

import android.app.Application;
import android.content.Context;
import android.os.Environment;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.wry.myphotowall.config.ImagePipelineConfigFactory;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/3/13 0013.
 */

public class MyApplication extends Application {
    public static Context mContext;
    public static final int WRITE_EXTERNAL_STORAGE = 100;
    public static final int CAMERA_PERMISSION = 101;
    public static final int CUT = 2;

    @Override
    public void onCreate() {
        super.onCreate();
        this.mContext = getApplicationContext();


        ImagePipelineConfig imagePipelineConfig = ImagePipelineConfigFactory.getImagePipelineConfig(mContext);
        Fresco.initialize(this, imagePipelineConfig);

        List<File> filelist = new ArrayList<File>();
        File picpath = new File(Environment.getExternalStorageDirectory() + "/" + getResources().getString(R.string.app_name) + "/image/");//用于存放相机拍照的临时图片
        filelist.add(picpath);
        for (File file : filelist) {
            if (!file.exists()) {
                file.mkdirs();
            }
        }
    }
}
